package com.itheima.servlet;

import com.itheima.dao.UserDao;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanLife {

    /**
     * Bean对象的生命周期
     * @param args
     */
    public static void main(String[] args) {

        ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("bean_annotation.xml");
        UserDao userDao1 = classPathXmlApplicationContext.getBean("UserDao", UserDao.class);
        UserDao userDao2 = classPathXmlApplicationContext.getBean("UserDao", UserDao.class);

        System.out.println(userDao1 == userDao2);

        classPathXmlApplicationContext.close();
    }

}
